﻿using System;
using DapperExtensions.Mapper;

namespace ZilLion.Task.Domain.Entity
{
    [Serializable]
    public class TaskStateEntity
    {
        public string NodeId { get; set; }

        public string Taskid { get; set; }

        /// <summary>
        ///     作业执行状态 0-运行中，1-停止
        /// </summary>
        public short Taskstatus { get; set; }

        /// <summary>
        ///     预计下次运行时间
        /// </summary>
        public DateTime Tasknextruntime { get; set; }

        /// <summary>
        ///     最后运行时间
        /// </summary>
        public DateTime Tasklastruntime { get; set; }
    }

    public sealed class TaskRunLogMapper : ClassMapper<TaskStateEntity>
    {
        public TaskRunLogMapper()
        {
            Table("task_state");
            Map(f => f.NodeId).Key(KeyType.Assigned).Column("nodeid");
            Map(f => f.Taskid).Key(KeyType.Assigned).Column("taskid");
            Map(f => f.Taskstatus).Column("taskstatus");
            Map(f => f.Tasknextruntime).Column("tasknextruntime");
            Map(f => f.Tasklastruntime).Column("tasklastruntime");
        }
    }
}